/*************登录切换*************/
var h3s = Array.from($(".login-head > h3"));
var lDivs = Array.from($(".login-layer > .login-body"));

h3s.forEach(function(h,lap){
	
	h.onclick = function(){
		ind = lap;
		changeH();
	}
});

var ind = 0;
changeH();

function changeH(){
	
	h3s.forEach(function(h,lap){
		
		lDivs[lap].style.display = "none";
		h.className = "";
	});
	
	h3s[ind].className = "curLogin";
	lDivs[ind].style.display = "block";
}

/******************光标监测******************/
$(".login-box > input").each(function(ind,pt){
	
	$(pt).blur(function(){
		
		$(pt).css({
			"border-color":"#ccc",
		})
		
	}).focusin(function(){
		
		$(pt).css({
			"border-color":"#de3030",
		})
	})
	
});

$(".phone-number > .text").blur(function(){
	
	$(".phone-number").css({
		"border-color":"#ccc",
	})
	
}).focusin(function(){
	
	$(".phone-number").css({
		"border-color":"#de3030",
	})
});

/********************手机号登录切换*******************/

$(".user-log").css({
	"display":"block"
});

$(".phone-log").css({
	"display":"none"
});

$(".user-log form > .phone-ac-login").click(function(){
	
	$(".user-log").css({
		"display":"none"
	});
	
	$(".phone-log").css({
		"display":"block"
	});
	
});


/*************************登录操作***************************/
/*用户名登录*/
var sBtn = document.getElementById("s-btn");
var user = document.getElementById("s-user");
var sPW = document.getElementById("s-password");


/*手机验证码登录*/
sBtn.onclick = function(){
	
	setCookie("user",{"name":user.value,"password":sPW.value},7);
	
	window.location.href = "index.html";
}




/*商家登录*/

